//metaparser.h
#pragma once

class MetaParser
{
public:
	MetaParser(){}
	~MetaParser()
	{
		textParams.ForEachValue(val_deleter());
	}
	void processSql(CString& sql);
	void setTextParam(const CString& name, const CValue* pValue)
	{
		CValue* pExist;
		if(textParams.Lookup(name, pExist))
			delete pExist;
		textParams[name] = new CValue(*pValue);
	}
	void reset()
	{
		textParams.ForEachValue(val_deleter());
		textParams.RemoveAll();
	}
protected:
	struct val_deleter{void operator()(CValue* pVal){delete pVal;}};
	BOOL makeString(const CString& paramName, int mod, CString& paramString);
	void processParam(struct parsingData& pd);
	void processMetaName(struct parsingData& pd);
	CNoCaseMap<CValue*> textParams;
};
